import { Map } from "immutable";
import {
    CHANGE_RADIO_CATEGORY,
    CHANGE_CURRENT_ID,
    CHANGE_RECOMMENDS,
    CHANGE_RADIOS,
} from './constants';

const defaultState = Map({
    categories: [],//轮播分类数据
    currentId: 0, //当前选择的分类的id
    recommends: [],//优秀电台数据
    radios: [],   //店拍排行榜数据
})

export default (state = defaultState, action) => {
    switch (action.type) {

        case CHANGE_RADIO_CATEGORY:
            return state.set("categories", action.categories);

        case CHANGE_CURRENT_ID:
            return state.set("currentId", action.currentId);

        case CHANGE_RECOMMENDS:
            return state.set("recommends", action.recommends);

        case CHANGE_RADIOS:
            return state.set("radios", action.radios);

        default:
            return state;
    }
}